New signal drag-action-requested
authorFederico Mena Quintero <federico@gnome.org>
Mon, 3 Dec 2012 23:09:57 +0000 (17:09 -0600)
committerFederico Mena Quintero <federico@gnome.org>
Mon, 3 Dec 2012 23:32:10 +0000 (17:32 -0600)
We'll use this signal to ask the caller about what drag action to indicate
when something is being hovered on an item in the places sidebar.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
gtk/gtkmarshalers.list
gtk/gtkplacessidebar.c

index d826fc71cfa37b57abc85ad7952097f6daab170e..83423a764478637bb3830730c1edf556735357bf 100644 (file)
@@ -121,3 +121,4 @@ VOID:UINT,UINT
 VOID:VOID
 OBJECT:OBJECT,INT,INT
 VOID:POINTER,POINTER,POINTER,POINTER,STRING
+VOID:OBJECT,STRING,POINTER,POINTER
index cc6ceab0c1330a2ccf2c0d652da2aa00974000db..e58609950c3e92cd401b5980ec0db7ffc87b5bc5 100644 (file)
@@ -138,6 +138,11 @@ struct _GtkPlacesSidebarClass {
        void (* show_error_message)    (GtkPlacesSidebar *sidebar,
                                        const char       *primary,
                                        const char       *secondary);
+       void (* drag_action_requested) (GtkPlacesSidebar *sidebar,
+                                       GdkDragContext   *context,
+                                       const char       *uri,
+                                       GList            *uri_list,
+                                       int              *action);
 };
 
 enum {
@@ -181,6 +186,7 @@ enum {
        EMPTY_TRASH_REQUESTED,
        INITIATED_UNMOUNT,
        SHOW_ERROR_MESSAGE,
+       DRAG_ACTION_REQUESTED,
        LAST_SIGNAL,
 };
 
@@ -307,6 +313,20 @@ emit_show_error_message (GtkPlacesSidebar *sidebar, const char *primary, const c
                       primary, secondary);
 }
 
+static void
+emit_drag_action_requested (GtkPlacesSidebar *sidebar,
+                           GdkDragContext *context,
+                           const char *uri,
+                           GList *uri_list,
+                           int *action)
+{
+       g_signal_emit (sidebar, places_sidebar_signals[DRAG_ACTION_REQUESTED], 0,
+                      context,
+                      uri,
+                      uri_list,
+                      action);
+}
+
 static gint
 get_icon_size (GtkPlacesSidebar *sidebar)
 {
@@ -3728,6 +3748,19 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
                              G_TYPE_NONE, 2,
                              G_TYPE_STRING,
                              G_TYPE_STRING);
+
+       places_sidebar_signals [DRAG_ACTION_REQUESTED] =
+               g_signal_new (I_("drag-action-requested"),
+                             G_OBJECT_CLASS_TYPE (gobject_class),
+                             G_SIGNAL_RUN_FIRST,
+                             G_STRUCT_OFFSET (GtkPlacesSidebarClass, drag_action_requested),
+                             NULL, NULL,
+                             _gtk_marshal_VOID__OBJECT_STRING_POINTER_POINTER,
+                             G_TYPE_NONE, 4,
+                             GDK_TYPE_DRAG_CONTEXT,
+                             G_TYPE_STRING,
+                             G_TYPE_POINTER, /* FIXME: (GList *) is there something friendlier to language bindings? */
+                             G_TYPE_POINTER  /* FIXME: (inout int) is there something friendlier to language bindings? */);
 }
 
 static void